{% extends "theme/layout.html" %}

{% block content %}
<div id="innerContainer">
  <div class="innerTop"></div>
  <div id="outerContent">
    <div id="content">
      <div class="contentTop"></div>
      <ul id="posts">
        <div class="postsTop"></div>
        {% for post in posts %}
        <li class="list">
          <div class="postHeader">
            <h2>
              <a href="{{ post.getUrl() }}">{{ post.title|e }}</a>
              {% if post.category %}
              <span class="category"> - [<a href="{{ post.category.getUrl() }}">{{ post.category.name }}</a>]</span>
              {% endif %}
            </h2>
            <h3>{{ post.date|date("%Y-%m-%d") }}</h3>
          </div>
          <div class="postBody">
            {{ post.content }}
            <div class="clear"></div>
          </div>
          <div class="postFooter">
            {% if post.tags %}
            <div class="tags">Tag: {% for tag in post.tags %}<a href="/tag/{{ tag|e }}">{{ tag|e }}</a>{% endfor %} </div>
            {% endif %}
            <div class="menubar"> 发表于<span class="time">{{ post.date|date("%H:%M:%S") }}</span> | <a href="{{ post.getUrl() }}" class="readmore">阅读全文</a> | <a href="{{ post.getUrl() }}#cmt" class="cmt">评论 <span class="count">{{ post.comment_count }}</span></a></div>
          </div>
        </li>
        {% endfor %}
        <div class="postsBottom"></div>
      </ul>
      <div class="pageNavi">
        {% if not pager.isFirstPage() %}
        <a href="?page={{ pager.getFirstPage() }}">第一页</a>
        <a href="?page={{ pager.getPreviousPage() }}">上一页</a>
        {% endif %}

        {% for link in pager.getLinks(10) %}
          {% if link == pager.getPage() %}
          {{ link }}
          {% else %}
          <a href="?page={{ link }}">{{ link }}</a>
          {% endif %}
        {% endfor %}

        {% if not pager.isLastPage() %}
        <a href="?page={{ pager.getNextPage() }}">下一页</a>
        <a href="?page={{ pager.getLastPage() }}">最末页</a>
        {% endif %}
      </div>
      <div class="contentBottom"></div>                    
    </div>
  </div>
  <div id="outerSidebar">
    <div id="sidebar">
      <div class="sideTop"></div>
      {% for widget in blog.sidebar(1) %}
      <div id="{{ widget.key_name }}" class="module">
      	<div class="modTop"></div>
      	<h2>{{ widget.name() }}</h2>
      	<div class="modBody">
      	  {{ widget.body() }}
        </div>
        <div class="modBottom"></div>
      </div>
      {% endfor %}
      <div class="sideBottom"></div>
    </div>
  </div>
  <div class="innerBottom"></div>
  <div class="clear"></div>
</div>
{% endblock %}